package com.mxnavi.naviserver;

import android.os.Parcel;
import android.os.Parcelable;


/**
 * 数据类----回避区域相关信息
 * 包括 区域信息，经纬度信息，回避区域半径等信息
 */
public class CAvoidArea implements Parcelable {

    public static final Creator<CAvoidArea> CREATOR =
            new Creator<CAvoidArea>() {

                @Override
                public CAvoidArea createFromParcel(Parcel source) {
                    // TODO Auto-generated method stub
                    // 从Parcel读取通过writeToParcel方法写入的Person的相关成员信息

                    //更加读取到的信息，创建返回Person对象
                    return new CAvoidArea(source);
                }

                @Override
                public CAvoidArea[] newArray(int size) {
                    // TODO Auto-generated method stub
                    //返回Person对象数组
                    return new CAvoidArea[size];
                }
            };
    /**
     * 回避区域半径 100米
     */
    static final int AVOID_RADIUS_LEVEL_1 = 100;
    /**
     * 回避区域半径 200米
     */
    static final int AVOID_RADIUS_LEVEL_2 = 200;
    /**
     * 回避区域半径 300米
     */
    static final int AVOID_RADIUS_LEVEL_3 = 300;
    /**
     * 回避区域半径 400米
     */
    static final int AVOID_RADIUS_LEVEL_4 = 400;
    /**
     * 回避区域半径 500米
     */
    static final int AVOID_RADIUS_LEVEL_5 = 500;
    static final int AVOID_TYPE_ROAD = 1;
    static final int AVOID_TYPE_AREA = 2;
    /**
     * 回避区域 省
     */
    public String mProvince = null;
    /**
     * 回避区域 市
     */
    public String mCity = null;
    /**
     * 回避区域 区/县
     */
    public String mArea = null;
    /**
     * 经纬度
     */
    public double mLongitude = 0;
    public double mLatitude = 0;
    /**
     * 回避区域 半径
     * 默认为300米
     */
    public int mAvoidRadiusLevel = AVOID_RADIUS_LEVEL_3;
    public CAvoidArea() {
    }

    public CAvoidArea(Parcel in) {
        readFromParcel(in);
    }

    public CAvoidArea(String province, String city, String area,
                      double longitude, double latitude, int avoidRadiusLevel) {
        mProvince = province;
        mCity = city;
        mArea = area;
        mLongitude = longitude;
        mLatitude = latitude;
        mAvoidRadiusLevel = avoidRadiusLevel;
    }

    @Override
    public int describeContents() {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public void writeToParcel(Parcel arg0, int arg1) {
        // TODO Auto-generated method stub
        arg0.writeString(mProvince);
        arg0.writeString(mCity);
        arg0.writeString(mArea);
        arg0.writeDouble(mLongitude);
        arg0.writeDouble(mLatitude);
        arg0.writeInt(mAvoidRadiusLevel);
    }

    public void readFromParcel(Parcel in) {
        mProvince = in.readString();
        mCity = in.readString();
        mArea = in.readString();
        mLongitude = in.readDouble();
        mLatitude = in.readDouble();
        mAvoidRadiusLevel = in.readInt();
    }

}
